<?php
/***********************************************************************
 * @package    	IvanEngine
 * @subpackage 	Core
 * @author     	Ivan <ivanzx@msn.com>
 * @created    	2010-05-19
 ***********************************************************************/
if(defined("IVANENGINE_CORE_VALIDATOR_URL"))
	die("Redefinition macro in :".__FILE__."(".__LINE__.")");
define("IVANENGINE_CORE_VALIDATOR_URL", true);

require_once (dirname(__FILE__).'/ValidatorRegex.php');

class CValidatorURL extends CValidatorRegex
{
	protected function Initialize($options = array(), $messages = array())
  	{
  		parent::Initialize($options, $messages);
		$this->SetOption('pattern', '~^
	      (https?|ftps?)://                       # http or ftp (+SSL)
	      (
	        ([a-z0-9-]+\.)+[a-z]{2,6}             # a domain name
	          |                                   #  or
	        \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}    # a IP address
	      )
	      (:[0-9]+)?                              # a port (optional)
	      (/?|/\S+)                               # a /, nothing or a / with something
	    $~ix');
  	}
}
?>